\hypertarget{classobject__list__property_1_1_object_list_property}{
\section{object\_\-list\_\-property.ObjectListProperty Class Reference}
\label{classobject__list__property_1_1_object_list_property}\index{object\_\-list\_\-property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}}
}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
def \hyperlink{classobject__list__property_1_1_object_list_property_a51339aaaca5544cbde1e60ff2a91ef64}{\_\-\_\-init\_\-\_\-}
\item 
def \hyperlink{classobject__list__property_1_1_object_list_property_a3c01b8199ed18394382e5fb4ddd04dc6}{validate\_\-list\_\-contents}
\item 
def \hyperlink{classobject__list__property_1_1_object_list_property_affa6030788787c5ba4a392ab2e73b94a}{get\_\-value\_\-for\_\-datastore}
\item 
def \hyperlink{classobject__list__property_1_1_object_list_property_a5b2466b7ad73cb5dc67da6e0a9dabfca}{make\_\-value\_\-from\_\-datastore}
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\begin{DoxyVerb}A property that stores a list of serializable class instances

This is a paramaterized property; the parameter must be a class with
'serialize' and 'deserialize' methods, and all items must conform to
this type

Will store serialized objects of strings up to 500 characters in length. For
longer strings, change line with #! comment: 'str' -> 'db.Text' and deal 
with encoding / decoding

Example:

class Record:
    def __init__(self, who, timestamp=None):
        self.who = who.key() if hasattr(who, 'key') else who # Some user model
        self.timestamp = timestamp if timestamp else time.time()
    
    def serialize(self):
        return "%s@%s" % (str(self.who), str(self.time))
    
    @classmethod
    def deserialize(cls, value):
        [ who, timestamp ] = value.split('@', 1)
        return cls(who= db.Key(who), timestamp= float(timestamp))

class Usage_Tracker(db.Model):
    records = ObjectListProperty(Record, indexed=False)
\end{DoxyVerb}
 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classobject__list__property_1_1_object_list_property_a51339aaaca5544cbde1e60ff2a91ef64}{
\index{object\_\-list\_\-property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}!\_\-\_\-init\_\-\_\-@{\_\-\_\-init\_\-\_\-}}
\index{\_\-\_\-init\_\-\_\-@{\_\-\_\-init\_\-\_\-}!object_list_property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}}
\subsubsection[{\_\-\_\-init\_\-\_\-}]{\setlength{\rightskip}{0pt plus 5cm}def object\_\-list\_\-property.ObjectListProperty.\_\-\_\-init\_\-\_\- (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{cls, }
\item[{}]{args, }
\item[{}]{kwargs}
\end{DoxyParamCaption}
)}}
\label{classobject__list__property_1_1_object_list_property_a51339aaaca5544cbde1e60ff2a91ef64}
\begin{DoxyVerb}Construct ObjectListProperty

Args:
    cls: Class of objects in list
    *args: Optional additional arguments, passed to base class
    **kwds: Optional additional keyword arguments, passed to base class
\end{DoxyVerb}
 

\subsection{Member Function Documentation}
\hypertarget{classobject__list__property_1_1_object_list_property_affa6030788787c5ba4a392ab2e73b94a}{
\index{object\_\-list\_\-property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}!get\_\-value\_\-for\_\-datastore@{get\_\-value\_\-for\_\-datastore}}
\index{get\_\-value\_\-for\_\-datastore@{get\_\-value\_\-for\_\-datastore}!object_list_property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}}
\subsubsection[{get\_\-value\_\-for\_\-datastore}]{\setlength{\rightskip}{0pt plus 5cm}def object\_\-list\_\-property.ObjectListProperty.get\_\-value\_\-for\_\-datastore (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{model\_\-instance}
\end{DoxyParamCaption}
)}}
\label{classobject__list__property_1_1_object_list_property_affa6030788787c5ba4a392ab2e73b94a}
\begin{DoxyVerb}Serialize list to send to datastore.

Returns:
    validated list appropriate to save in the datastore.
\end{DoxyVerb}
 \hypertarget{classobject__list__property_1_1_object_list_property_a5b2466b7ad73cb5dc67da6e0a9dabfca}{
\index{object\_\-list\_\-property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}!make\_\-value\_\-from\_\-datastore@{make\_\-value\_\-from\_\-datastore}}
\index{make\_\-value\_\-from\_\-datastore@{make\_\-value\_\-from\_\-datastore}!object_list_property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}}
\subsubsection[{make\_\-value\_\-from\_\-datastore}]{\setlength{\rightskip}{0pt plus 5cm}def object\_\-list\_\-property.ObjectListProperty.make\_\-value\_\-from\_\-datastore (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{db\_\-list}
\end{DoxyParamCaption}
)}}
\label{classobject__list__property_1_1_object_list_property_a5b2466b7ad73cb5dc67da6e0a9dabfca}
\begin{DoxyVerb}Deserialize datastore representation to list

Returns:
    The value converted for use as a model instance attribute.
\end{DoxyVerb}
 \hypertarget{classobject__list__property_1_1_object_list_property_a3c01b8199ed18394382e5fb4ddd04dc6}{
\index{object\_\-list\_\-property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}!validate\_\-list\_\-contents@{validate\_\-list\_\-contents}}
\index{validate\_\-list\_\-contents@{validate\_\-list\_\-contents}!object_list_property::ObjectListProperty@{object\_\-list\_\-property::ObjectListProperty}}
\subsubsection[{validate\_\-list\_\-contents}]{\setlength{\rightskip}{0pt plus 5cm}def object\_\-list\_\-property.ObjectListProperty.validate\_\-list\_\-contents (
\begin{DoxyParamCaption}
\item[{}]{self, }
\item[{}]{value}
\end{DoxyParamCaption}
)}}
\label{classobject__list__property_1_1_object_list_property_a3c01b8199ed18394382e5fb4ddd04dc6}
\begin{DoxyVerb}Validates that all items in the list are of the correct type.

Returns:
    The validated list.

Raises:
    BadValueError if the list has items are not instances of the
    cls given to the constructor.
\end{DoxyVerb}
 

The documentation for this class was generated from the following file:\begin{DoxyCompactItemize}
\item 
object\_\-list\_\-property.py\end{DoxyCompactItemize}
